# !/usr/bin/env python
# coding=utf-8
# @Time    : 2017/12/27 11:03
# @Author  : 6imensiva
# @Site    : https://gitee.com/dimensiva/wx_server_prototype.git
# @File    : decorator.py
# @Software: PyCharm
# @Version: 3.5.4
'修饰器使用演示'

import functools


def log(text):
	print text + '1'
	def decorator(func):
		print text + '2'
		@functools.wraps(func)
		def wrapper(*args, **kw):
			print '%s %s() %s %s:' % (text, func.__name__, args, type(args))
			return func(*args, **kw)
		print text + '3'
		return wrapper
	print text + '4'
	return decorator


@log('asd')
@log('fffffff')
def hello(s):
	print s


# flask启动时在注册到app中的模块中扫描接口
# from .error import error as main_blueprint
# app.register_blueprint(main_blueprint)
# from .api_1_0 import api as api_blueprint
# app.register_blueprint(api_blueprint)
# 检测到@api.route就把接口注册到路由中，@api.route放到最前面
# @api.route(current_config.FRONT_API_PREFIX + '/alive')
# @header.check_login(request)
# def alive():
# 	session["token"] = '132456789'
# 	return 'iam alivebbbb'


if __name__ == '__main__':
	hello('66666')